package com.booksys.service.Impl;

import com.booksys.mapper.CityDao;
import com.booksys.pojo.City;
import com.booksys.pojo.CityExample;
import com.booksys.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityDao cityDao;

    @Override
    public List<City> getCities(int provinceId) {
        CityExample cityExample = new CityExample();
        CityExample.Criteria criteria = cityExample.createCriteria();
        if(provinceId!=0){
            criteria.andProvinceIdEqualTo(provinceId);
        }
        List<City> list = cityDao.selectByExample(cityExample);
        return list;
    }
}
